package com.kan.awaits.test;

import java.util.List;

import org.bson.types.ObjectId;

import com.kan.awaits.mongo.annotations.Capped;
import com.kan.awaits.mongo.annotations.Collection;
import com.kan.awaits.mongo.annotations.Embedded;
import com.kan.awaits.mongo.annotations.Entity;
import com.kan.awaits.mongo.annotations.Id;
import com.kan.awaits.mongo.annotations.Reference;
import com.kan.awaits.mongo.annotations.Version;
import com.kan.awaits.mongo.annotations.Reference.ReferenceCascade;

@Entity
@Collection(name = "u", capped = @Capped(size = 1024 * 1024))
public class User
{
	@Id
	private ObjectId id;

	private String name;

	@Reference(lazy = true, cascade = { ReferenceCascade.ALL }, referenceCollection = @Collection(name = "address2", automaticallyGenerate = true))
	private Address address;

	@Reference
	// @Type
	private List<Address> addresses;

	@Embedded
	private Address eAddress;

	@Version
	private long version;

	public ObjectId getId()
	{
		return id;
	}

	public void setId(ObjectId id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public Address getAddress()
	{
		return address;
	}

	public void setAddress(Address address)
	{
		this.address = address;
	}
}
